﻿USE [ShopDB]
GO

/****** Object:  StoredProcedure [dbo].[BasketAddProduct]    Script Date: 04/07/2011 21:09:05 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BasketAddProduct]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[BasketAddProduct]
GO

USE [ShopDB]
GO

/****** Object:  StoredProcedure [dbo].[BasketAddProduct]    Script Date: 04/07/2011 21:09:05 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


-- =============================================
-- Author:		Alexander Litvinenko
-- Create date: 2011
-- Description:	Add product to basket
-- =============================================
CREATE PROCEDURE [dbo].[BasketAddProduct]
	@UserName nvarchar(256),
	@ProductID bigint,
	@Quantity bigint
AS
BEGIN
	IF NOT EXISTS(SELECT * FROM Baskets WHERE UserName = @UserName AND ProductID = @ProductID)
		INSERT INTO Baskets
		VALUES(@UserName, @ProductID, @Quantity)
END


GO


